package main

import (
	"fmt"
	"github.com/the404/gotest/.vendor/src/github.com/astaxie/beego/logs"
)

func main() {
	res := letterCasePermutation("a")
	fmt.Println(res)
}

func letterCasePermutation(S string) []string {
	var res []string
	strs := []byte(S)
	backtrade(&res, strs, 0)
	return res
}

var count = 0

func backtrade(res *[]string, strs []byte, i int) {
	count++
	logs.Info(count, string(strs), i)
	if i >= len(strs) {
		*res = append(*res, string(strs))
		return
	}

	if strs[i] >= 'a' && strs[i] <= 'z' {
		strs[i] -= 32
		backtrade(res, strs, i+1)
		strs[i] += 32
	}
	if strs[i] >= 'A' && strs[i] <= 'Z' {
		strs[i] += 32
		backtrade(res, strs, i+1)
		strs[i] -= 32
	}
	backtrade(res, strs, i+1)
}

